/*
 * PPrincipal.java
 *
 * Created on 31 de agosto de 2008, 08:50 AM
 */
package GUI;

import javax.swing.ImageIcon;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author  Propietario
 */
public class PPrincipal extends javax.swing.JFrame {

    private List imagenes;
    private String po;
    public void cargarimagen() {
///////////////////////l aimagen 0 es la principal///////////////////////////////
        ImageIcon i0 = new ImageIcon("image/BJ.gif");
        //---------imagenes de corazones        
        ImageIcon i1 = new ImageIcon("image/1c.gif");
        ImageIcon i2 = new ImageIcon("image/2c.gif");
        ImageIcon i3 = new ImageIcon("image/3c.gif");
        ImageIcon i4 = new ImageIcon("image/4c.gif");
        ImageIcon i5 = new ImageIcon("image/5c.gif");
        ImageIcon i6 = new ImageIcon("image/6c.gif");
        ImageIcon i7 = new ImageIcon("image/7c.gif");
        ImageIcon i8 = new ImageIcon("image/8c.gif");
        ImageIcon i9 = new ImageIcon("image/9c.gif");
        ImageIcon i10 = new ImageIcon("image/10c.gif");
        ImageIcon i11 = new ImageIcon("image/11c.gif");
        ImageIcon i12 = new ImageIcon("image/12c.gif");
        ImageIcon i13 = new ImageIcon("image/13c.gif");
        //--------imagenes de diamantes
        ImageIcon i14 = new ImageIcon("image/1d.gif");
        ImageIcon i15 = new ImageIcon("image/2d.gif");
        ImageIcon i16 = new ImageIcon("image/3d.gif");
        ImageIcon i17 = new ImageIcon("image/4d.gif");
        ImageIcon i18 = new ImageIcon("image/5d.gif");
        ImageIcon i19 = new ImageIcon("image/6d.gif");
        ImageIcon i20 = new ImageIcon("image/7d.gif");
        ImageIcon i21 = new ImageIcon("image/8d.gif");
        ImageIcon i22 = new ImageIcon("image/9d.gif");
        ImageIcon i23 = new ImageIcon("image/10d.gif");
        ImageIcon i24 = new ImageIcon("image/11d.gif");
        ImageIcon i25 = new ImageIcon("image/12d.gif");
        ImageIcon i26 = new ImageIcon("image/13d.gif");
        //-------imagenes de picas
        ImageIcon i27 = new ImageIcon("image/1p.gif");
        ImageIcon i28 = new ImageIcon("image/2p.gif");
        ImageIcon i29 = new ImageIcon("image/3p.gif");
        ImageIcon i30 = new ImageIcon("image/4p.gif");
        ImageIcon i31 = new ImageIcon("image/5p.gif");
        ImageIcon i32 = new ImageIcon("image/6p.gif");
        ImageIcon i33 = new ImageIcon("image/7p.gif");
        ImageIcon i34 = new ImageIcon("image/8p.gif");
        ImageIcon i35 = new ImageIcon("image/9p.gif");
        ImageIcon i36 = new ImageIcon("image/10p.gif");
        ImageIcon i37 = new ImageIcon("image/11p.gif");
        ImageIcon i38 = new ImageIcon("image/12p.gif");
        ImageIcon i39 = new ImageIcon("image/13p.gif");
        //----------imagenes de treboles
        ImageIcon i40 = new ImageIcon("image/1t.gif");
        ImageIcon i41 = new ImageIcon("image/2t.gif");
        ImageIcon i42 = new ImageIcon("image/3t.gif");
        ImageIcon i43 = new ImageIcon("image/4t.gif");
        ImageIcon i44 = new ImageIcon("image/5t.gif");
        ImageIcon i45 = new ImageIcon("image/6t.gif");
        ImageIcon i46 = new ImageIcon("image/7t.gif");
        ImageIcon i47 = new ImageIcon("image/8t.gif");
        ImageIcon i48 = new ImageIcon("image/9t.gif");
        ImageIcon i49 = new ImageIcon("image/10t.gif");
        ImageIcon i50 = new ImageIcon("image/11t.gif");
        ImageIcon i51 = new ImageIcon("image/12t.gif");
        ImageIcon i52 = new ImageIcon("image/13t.gif");
///////////////////////imagen de reves /////////////////////////////////////////
        ImageIcon i53 = new ImageIcon("image/Back.gif");

        // cargara las imagenes al vector       
        imagenes = new ArrayList();
        imagenes.add(i0);
        imagenes.add(i1);
        imagenes.add(i2);
        imagenes.add(i3);
        imagenes.add(i4);
        imagenes.add(i5);
        imagenes.add(i6);
        imagenes.add(i7);
        imagenes.add(i8);
        imagenes.add(i9);
        imagenes.add(i10);
        imagenes.add(i11);
        imagenes.add(i12);
        imagenes.add(i13);
        imagenes.add(i14);
        imagenes.add(i15);
        imagenes.add(i16);
        imagenes.add(i17);
        imagenes.add(i18);
        imagenes.add(i19);
        imagenes.add(i20);
        imagenes.add(i21);
        imagenes.add(i22);
        imagenes.add(i23);
        imagenes.add(i24);
        imagenes.add(i25);
        imagenes.add(i26);
        imagenes.add(i27);
        imagenes.add(i28);
        imagenes.add(i29);
        imagenes.add(i30);
        imagenes.add(i31);
        imagenes.add(i32);
        imagenes.add(i33);
        imagenes.add(i34);
        imagenes.add(i35);
        imagenes.add(i36);
        imagenes.add(i37);
        imagenes.add(i38);
        imagenes.add(i39);
        imagenes.add(i40);
        imagenes.add(i41);
        imagenes.add(i42);
        imagenes.add(i43);
        imagenes.add(i44);
        imagenes.add(i45);
        imagenes.add(i46);
        imagenes.add(i47);
        imagenes.add(i48);
        imagenes.add(i49);
        imagenes.add(i50);
        imagenes.add(i51);
        imagenes.add(i52);
        imagenes.add(i53);
    }

    public PPrincipal(String port) {
        //ImageIcon carta = new ImageIcon(imagenP);
        //List imagenes = new ArrayList();
        cargarimagen();
        initComponents();
        po= port; 
        jLabel1.setIcon((ImageIcon)imagenes.get(0));
        this.setTitle("Black Jack");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        PantallaPrincipal = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLBien = new javax.swing.JLabel();
        jBEntrar = new javax.swing.JButton();
        jBSalir = new javax.swing.JButton();
        jBEntrar1 = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        PantallaPrincipal.setBackground(new java.awt.Color(0, 0, 0));

        jLBien.setFont(new java.awt.Font("Arial", 0, 48));
        jLBien.setForeground(new java.awt.Color(255, 153, 0));
        jLBien.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLBien.setText("BIENVENDIDO");

        jBEntrar.setBackground(new java.awt.Color(0, 0, 0));
        jBEntrar.setFont(new java.awt.Font("Arial", 1, 11));
        jBEntrar.setForeground(new java.awt.Color(204, 102, 0));
        jBEntrar.setText("VS PLAYER");
        jBEntrar.setFocusPainted(false);
        jBEntrar.setFocusable(false);
        jBEntrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBEntrarActionPerformed(evt);
            }
        });

        jBSalir.setBackground(new java.awt.Color(0, 0, 0));
        jBSalir.setFont(new java.awt.Font("Arial", 1, 11));
        jBSalir.setForeground(new java.awt.Color(204, 102, 0));
        jBSalir.setText("SALIR");
        jBSalir.setFocusable(false);
        jBSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSalirActionPerformed(evt);
            }
        });

        jBEntrar1.setBackground(new java.awt.Color(0, 0, 0));
        jBEntrar1.setFont(new java.awt.Font("Arial", 1, 11));
        jBEntrar1.setForeground(new java.awt.Color(204, 102, 0));
        jBEntrar1.setText("VS CPU");
        jBEntrar1.setFocusPainted(false);
        jBEntrar1.setFocusable(false);
        jBEntrar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBEntrar1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PantallaPrincipalLayout = new javax.swing.GroupLayout(PantallaPrincipal);
        PantallaPrincipal.setLayout(PantallaPrincipalLayout);
        PantallaPrincipalLayout.setHorizontalGroup(
            PantallaPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PantallaPrincipalLayout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(PantallaPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jBSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBEntrar1, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
                    .addComponent(jBEntrar, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PantallaPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLBien)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(77, 77, 77))
        );
        PantallaPrincipalLayout.setVerticalGroup(
            PantallaPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PantallaPrincipalLayout.createSequentialGroup()
                .addContainerGap(25, Short.MAX_VALUE)
                .addGroup(PantallaPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PantallaPrincipalLayout.createSequentialGroup()
                        .addComponent(jLBien, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(36, 36, 36)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PantallaPrincipalLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jBEntrar)
                        .addGap(38, 38, 38)
                        .addComponent(jBEntrar1)
                        .addGap(189, 189, 189)
                        .addComponent(jBSalir)
                        .addGap(17, 17, 17)))
                .addGap(22, 22, 22))
        );

        jMenu1.setText("Archivo");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Acerca de...");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PantallaPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PantallaPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void jBEntrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBEntrarActionPerformed
        // TODO add your handling code here:
        VentanaInvitarJugador Invitar = new VentanaInvitarJugador(imagenes, po);
        Invitar.setVisible(true);
        //PantallaJugador pan = new PantallaJugador(imagenes);
        //pan.setVisible(true);
        this.dispose();
        
    }//GEN-LAST:event_jBEntrarActionPerformed

    private void jBSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSalirActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jBSalirActionPerformed

private void jBEntrar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBEntrar1ActionPerformed
// TODO add your handling code here:
    PantallaVScpu pan = new PantallaVScpu(imagenes);
        pan.setVisible(true);
        this.dispose();
}//GEN-LAST:event_jBEntrar1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel PantallaPrincipal;
    private javax.swing.JButton jBEntrar;
    private javax.swing.JButton jBEntrar1;
    private javax.swing.JButton jBSalir;
    private javax.swing.JLabel jLBien;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    // End of variables declaration//GEN-END:variables
    // cerrar ventana

    @Override
    protected void processWindowEvent(WindowEvent e) {
        super.processWindowEvent(e);
        if (e.getID() == WindowEvent.WINDOW_CLOSING) {
            System.exit(0);
        }
    }
}
